package com.group9.handinhand.service.so;

import org.apache.commons.lang.ArrayUtils;

import com.group9.handinhand.dao.model.MembershipRequest;
/**
 * Class for service of membership request
 *
 */
public class MembershipRequestSO extends AbstractBaseSO {
	
    private CommunitySO community;
	private UserSO user;
	/**
	 * converts to model object of membership request
	 * @param ignoreProperties
	 * @return
	 */
	public MembershipRequest convertToModelObject(String... ignoreProperties) {
		MembershipRequest model = (MembershipRequest) convert(new MembershipRequest(),
				(String[]) ArrayUtils.addAll(ignoreProperties,new String[]{"community","user"}));
		model.setUser(this.user.convertToModelObject());
		model.setCommunity(this.community.convertToModelObject(new String[]{"moderators", "posts", "events","requests","offers","members"}));
		return model;
	}

	public CommunitySO getCommunity() {
		return community;
	}

	public void setCommunity(CommunitySO community) {
		this.community = community;
	}

	public UserSO getUser() {
		return user;
	}

	public void setUser(UserSO user) {
		this.user = user;
	}

	@Override
	public String toString() {
		return "MembershipRequestSO [community=" + community + ", user=" + user
				+ "]";
	}
	
	
}
